package spring.cloud.tasks.server;

import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * 用于协调任务调取的信息
 */
public class ProcessorRunTimeInfo {
    @Setter
    @Getter
    public String processorId;
    @Setter
    @Getter
    public Long version;
    @Setter
    @Getter
    public List<String> workerIdList = new ArrayList<String>();

    public ProcessorRunTimeInfo(String processorId) {
        this.processorId = processorId;
    }

    public void updateVersion() {
        if (version == null) {
            version = 1l;
        } else {
            version++;
        }
    }
}
